<template>
  <div>
    <div>
      <table>
        <tr>
          <td><el-button type="primary" @click="onSubmitFormPre(ruleFormRef)"> 保存 </el-button></td>
          <td><el-button type="primary" @click="backList"> 返回列表 </el-button></td>
          <td @click="dialogCicategoryVisible = true">配置项分类</td>
          <td>
            <el-input
              v-model="addRequestTemplateFormData.categoryName"
              id="customerTypeNameInput"
              @click="dialogCicategoryVisible = true"
            />
          </td>
          <!-- <td :style="{ width: '200px' }"> <el-tree-select
			      ref="RequestType"
			      v-model="categorySelectValue"
			      :data="categorySelectList"
			      :render-after-expand="false"
			      check-strictly
			      check-on-click-node
				  :default-expand-all="true"
			      @change="changeType"
			    /></td> -->
          <td>
            <p
              v-if="addRequestTemplateFormData.categoryNo == null || addRequestTemplateFormData.categoryNo == ''"
              style="font-size: 20px; color: red"
            >
              请选择配置项分类
            </p>
          </td>
        </tr>
      </table>
      <el-dialog title="选择配置项分类" v-model="dialogCicategoryVisible">
        <div :style="{ height: '500px' }">
          <el-tree
            :data="categorySelectList"
            :props="defaultProps"
            :default-expand-all="true"
            @node-click="handleNodeClickcategory"
            class="custom-tree"
          />
        </div>
      </el-dialog>
    </div>
    <div class="card content-box">
      <el-form
        ref="ruleFormRef"
        :rules="rules"
        :model="addRequestTemplateFormData"
        style="width: 100%"
        label-width="122px"
        :disabled="addRequestTemplateFormData.categoryNo == ''"
      >
        <!-- <el-button type="primary" @click="serviceDir"> 服务目录 </el-button> -->
        <el-dialog title="选择服务目录" v-model="dialogServiceDirTableVisible">
          <div :style="{ height: '500px' }">
            <Custemerselect @send-data="sendCompanyNoData" />
          </div>
        </el-dialog>
        <el-dialog v-model="templateNameDialogVisible" title="内容模板名称" width="30%">
          <el-form style="width: 100%" label-width="120px">
            <el-form-item label="资产内容模板名称 :" prop="templateName">
              <el-input v-model="addRequestTemplateFormData.templateName" />
            </el-form-item>
          </el-form>
          <template #footer>
            <span class="dialog-footer">
              <el-button type="primary" @click="templateNameBtn(ruleFormRef)">保存</el-button>
            </span>
          </template>
        </el-dialog>

        <div>
          <p>基本信息</p>
        </div>
        <div v-if="showCustomerForm == false">
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="所属客户 :" prop="companyName" style="width: 48%">
                <el-input v-model="addRequestTemplateFormData.companyName" @click="dialogCompanyNoTableVisible = true" />
                <el-dialog title="选择客户" v-model="dialogCompanyNoTableVisible">
                  <div :style="{ height: '500px' }">
                    <Custemerselect @send-data="sendCompanyNoData" />
                  </div>
                </el-dialog>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="固定资产编号 :" prop="cino" style="width: 48%">
                <el-input v-model="addRequestTemplateFormData.cino" />
              </el-form-item>
              <!-- <el-form-item class="item" label="请求用户 :" prop="createdByName" style="width: 48%">
		          <el-input v-model="addRequestTemplateFormData.createdByName" @click="dialogCreatedByTableVisible = true" />
		          <el-dialog title="选择用户" v-model="dialogCreatedByTableVisible">
		            <div :style="{ height: '500px' }">
		              <Userselect @send-data="sendCreatedByData" :father="fatherValue" />
		            </div>
		          </el-dialog>
		        </el-form-item> -->
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="资产名称 :" prop="ciname" style="width: 48%">
                <el-input v-model="addRequestTemplateFormData.ciname" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="状态 :" style="width: 48%">
                <el-tree-select
                  v-model="useStatusSelectValue"
                  :data="useStatusSelectList"
                  :render-after-expand="false"
                  check-strictly
                  check-on-click-node
                  @change="changeuseStatus"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="位置 :" style="width: 48%">
                <el-tree-select
                  v-model="LocationSelectValue"
                  :data="LocationSelectList"
                  :render-after-expand="false"
                  check-strictly
                  check-on-click-node
                  @change="changeLocation"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="采购日期 :" style="width: 48%">
                <el-date-picker
                  v-model="addRequestTemplateFormData.buyDate"
                  type="datetime"
                  placeholder="请选择时间"
                  format="YYYY-MM-DD hh:mm:ss"
                  value-format="YYYY-MM-DD hh:mm:ss"
                  style="width: 98%"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="到货日期 :" style="width: 48%">
                <el-date-picker
                  v-model="addRequestTemplateFormData.arrivalDate"
                  type="datetime"
                  placeholder="请选择时间"
                  format="YYYY-MM-DD hh:mm:ss"
                  value-format="YYYY-MM-DD hh:mm:ss"
                  style="width: 98%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="预警日期 :" style="width: 48%">
                <el-date-picker
                  v-model="addRequestTemplateFormData.warningDate"
                  type="datetime"
                  placeholder="请选择时间"
                  format="YYYY-MM-DD hh:mm:ss"
                  value-format="YYYY-MM-DD hh:mm:ss"
                  style="width: 98%"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="生命周期(月) :" style="width: 48%">
                <el-input-number v-model="addRequestTemplateFormData.lifeCycle" :min="0" :max="999999" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="保修期(月) :" style="width: 48%">
                <el-input-number v-model="addRequestTemplateFormData.warranty" :min="0" :max="999999" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="资产原值 :" style="width: 48%">
                <el-input-number v-model="addRequestTemplateFormData.assetsOriginalValue" :min="0" :max="999999" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="部门 :" style="width: 48%">
                <el-tree-select
                  v-model="addRequestTemplateFormData.department"
                  :data="treeFilterData"
                  check-strictly
                  :render-after-expand="false"
                  show-checkbox
                  check-on-click-node
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="负责人 :" prop="owner" style="width: 48%">
                <el-input v-model="addRequestTemplateFormData.owner" @click="dialogCreatedByTableVisible = true" />
                <el-dialog title="选择用户" v-model="dialogCreatedByTableVisible">
                  <div :style="{ height: '500px' }">
                    <Userselect @send-data="sendOwnerData" :father="fatherValue" />
                  </div>
                </el-dialog>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item class="item" label="使用人 :" prop="userName" style="width: 48%">
                <el-input v-model="addRequestTemplateFormData.userName" @click="dialoguserNameTableVisible = true" />
                <el-dialog title="选择用户" v-model="dialoguserNameTableVisible">
                  <div :style="{ height: '500px' }">
                    <Userselect @send-data="senduserNameData" :father="fatherValue" />
                  </div>
                </el-dialog>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item class="item" label="折旧年限 :" style="width: 48%">
                <el-input-number v-model="addRequestTemplateFormData.depreciationIsZeroYears" :min="0" :max="999999" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <!-- <el-form-item class="item" label="部门 :" style="width: 48%">
			     	<el-tree-select
			     	  v-model="addRequestTemplateFormData.department"
			     	  :data="treeFilterData"
			     	  check-strictly
			     	  :render-after-expand="false"
			     	  show-checkbox
			     	  check-on-click-node
			     	/>
			     </el-form-item> -->
            </el-col>
          </el-row>
        </div>
        <div v-if="showCustomerForm == true">
          <form-create v-model="formData" :option="option" :rule="formCreateRules" />
        </div>
        <el-dialog title="选择客户" v-model="dialogCiCompanyNoTableVisible">
          <div :style="{ height: '500px' }">
            <Custemerselect @send-data="sendCiCompanyNoData" />
          </div>
        </el-dialog>
        <el-dialog title="选择位置" v-model="dialogLocationTableVisible">
          <div :style="{ height: '500px' }">
            <el-tree
              :data="LocationSelectList"
              :props="defaultProps"
              :default-expand-all="true"
              @node-click="handleNodeClickLocation"
              class="custom-tree"
            />
            <el-button class="dialogOkBtn" type="primary" @click="submitLocation" style="min-width: 80px"> 确 定 </el-button>
          </div>
        </el-dialog>
        <el-dialog title="选择部门" v-model="dialogDepartmentVisible">
          <div :style="{ height: '500px' }">
            <el-tree
              :data="departmentSelectList"
              :props="defaultProps"
              :default-expand-all="true"
              @node-click="handleNodeClickDepartment"
              class="custom-tree"
            />
            <el-button class="dialogOkBtn" type="primary" @click="submitDepartment" style="min-width: 80px"> 确 定 </el-button>
          </div>
        </el-dialog>
        <el-dialog title="选择负责人" v-model="dialogOwnerVisible">
          <div :style="{ height: '500px' }">
            <Userselect @send-data="sendOwner" :father="fatherValue" />
          </div>
        </el-dialog>
        <el-dialog title="选择使用人" v-model="dialogUserNameVisible">
          <div :style="{ height: '500px' }">
            <Userselect @send-data="sendUserNamer" :father="fatherValue" />
          </div>
        </el-dialog>
        <el-tabs v-model="activeName">
          <el-tab-pane label="附件" name="second">
            <el-button type="primary" @click="addAttachment"> 添加附件 </el-button>
            <ProTable
              ref="attachmentProTable"
              row-key="id"
              :indent="20"
              :data="attachmentList"
              :columns="attachmentColumns"
              :search-col="{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3 }"
            >
              <!-- 表格操作 -->
              <template #operation="scope">
                <el-button type="primary" link @click="deleteattachment(scope.$index)">删除</el-button>
              </template>
            </ProTable>
          </el-tab-pane>
          <el-tab-pane label="关联服务" name="glfw">
            <el-tree-select
              style="width: 360px"
              v-model="serviceDirectorySelectValue"
              :data="serviceDirectorySelectList"
              multiple
              :render-after-expand="false"
              show-checkbox
              check-strictly
              check-on-click-node
            />
            <el-button type="primary" @click="addServiceDir"> 添加 </el-button>
            <!-- <el-dialog title="选择关联配置项" v-model="selectCiDialogVisible">
			  					    <div :style="{ height: '500px' }">
			  					      <moreSelectCi @send-data="sendCiData" />
			  					    </div>
			  					  </el-dialog> -->
            <ProTable
              ref="serviceDirectoryProTable"
              row-key="id"
              :indent="20"
              :data="serviceDirectoryList"
              :columns="serviceDirectoryColumns"
              :search-col="{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3 }"
            >
              <!-- 表格操作 -->
              <template #operation="scope">
                <el-button type="primary" link @click="deleteserviceDirectory(scope.$index)">删除</el-button>
              </template>
            </ProTable>
          </el-tab-pane>
        </el-tabs>
      </el-form>
      <ImportExcel ref="dialogRef" />
    </div>
  </div>
</template>

<script setup lang="ts" name="basicForm">
import { ElMessage, FormInstance, FormRules, ElMessageBox } from "element-plus";
import { ref, reactive, onMounted, onBeforeUnmount, defineComponent } from "vue";
import { getjggl, emailtest, emailtestexchange, testSMSAccount, getjgglmessage, mergeCompany } from "@/api/modules/jggl";
import Userselect from "@/views/tools/userSelectbyOrgNo/index.vue";
import { isTelOrFax, isEmail } from "@/utils/eleValidate";
import WangEditor from "@/components/WangEditor/index.vue";
import Custemerselect from "@/views/tools/custemerSelect/index.vue";
import { useRoute, useRouter } from "vue-router";
import { getUserDepartment } from "@/api/modules/jggl";
import { dataDictionaryItemsfindByCode, getCategoryTreeAllData } from "@/api/modules/dataDictionary";
import {
  findPageScheduledTask,
  saveScheduledTask,
  deleteScheduledTask,
  findScheduledTaskById,
  editScheduledTask,
  uploadFile,
  saveRequestTemplate,
  findByTemplateId,
  findCiByIds,
  saveConfigureItemTemplate,
  findFormCustomByCiCategoryNo
} from "@/api/modules/systemTools";
import { useTabsStore } from "@/stores/modules/tabs";
import ProTable from "@/components/ProTable/index.vue";
import { ProTableInstance, ColumnProps, HeaderRenderScope } from "@/components/ProTable/interface";
import moreSelectCi from "@/views/tools/moreCiSelect/index.vue";
import ImportExcel from "@/views/tools/uploadFile/index.vue";
import { getCurrentLoginUser } from "@/api/modules/accessController";
import { saveRequest } from "@/api/modules/request";
import { getCimClass } from "@/api/modules/dictionary";
import { Base64 } from "js-base64";
import formCreate from "@form-create/element-ui"; // 引入 FormCreate
const router = useRouter();
const route = useRoute();
const tabStore = useTabsStore();
const UserselectRef = ref<InstanceType<typeof Userselect> | null>(null);

const templateNameDialogVisible = ref(false);
const showCustomerForm = ref(false);
const formCreateRules = ref<any>([]);
const dialogCicategoryVisible = ref(false);
const option = ref({
  submitBtn: false
});
const defaultProps = {
  children: "children",
  label: "data"
};
const handleNodeClickLocation = (data: any) => {
  console.log(data);
  locationCustomerSelectValue.value = data;
};
const locationCustomerSelectValue = ref();
const dialogLocationTableVisible = ref(false);
const submitLocation = () => {
  console.log("sdfaadfds");
  if (locationCustomerSelectValue.value == null || locationCustomerSelectValue.value == undefined) {
    ElMessage.info("请选择位置");
    return;
  }
  console.log("777777777");
  if ((locationCustomerSelectValue.value.children as any).length > 0) {
    ElMessage.info("请选择叶子节点");
    return;
  }
  console.log("8888888888");
  console.log(locationCustomerSelectValue.value);
  formData.value["loc"] = locationCustomerSelectValue.value.attr.cname;
  formData.value["locId"] = locationCustomerSelectValue.value.attr.id;
  //console.log(formData.value)
  //失去焦点避免重复打开 对话框
  let inputBox = document.getElementById("customerTypeNameInput") as HTMLInputElement; // 获取输入框元素
  inputBox.focus();
  // if(cwangEditor.value!=null){
  // 	(cwangEditor.value["editor"] as any).focus()
  // }
  dialogLocationTableVisible.value = false;
};

//负责人选择子组件弹窗回调方法
const sendOwner = (data: any) => {
  formData.value["ownerId"] = data.userId;
  formData.value["owner"] = data.fullName;
  //失去焦点避免重复打开 对话框
  let inputBox = document.getElementById("customerTypeNameInput") as HTMLInputElement; // 获取输入框元素
  inputBox.focus();
  //(cwangEditor.value as any).editor.focus()
  dialogOwnerVisible.value = false;
};
//使用人选择子组件弹窗回调方法
const sendUserNamer = (data: any) => {
  formData.value["userNameId"] = data.userId;
  formData.value["userName"] = data.fullName;
  //失去焦点避免重复打开 对话框
  let inputBox = document.getElementById("customerTypeNameInput") as HTMLInputElement; // 获取输入框元素
  inputBox.focus();
  //(cwangEditor.value as any).editor.focus()
  dialogUserNameVisible.value = false;
};

const dialogDepartmentVisible = ref(false);
const departmentSelectList = ref<any>([]);
//客户选择子组件弹窗回调方法
const dialogCiCompanyNoTableVisible = ref(false);
const sendCiCompanyNoData = (data: any) => {
  formData.value["companyName"] = data.orgName;
  formData.value["companyNo"] = data.orgNo;

  //失去焦点避免重复打开 对话框
  let inputBox = document.getElementById("customerTypeNameInput") as HTMLInputElement; // 获取输入框元素
  inputBox.focus();
  dialogCiCompanyNoTableVisible.value = false;
};
interface Tree {
  label: string;
  children?: Tree[];
  attr: any;
}
const dialogOwnerVisible = ref(false);
const dialogUserNameVisible = ref(false);

const handleNodeClickcategory = (data: Tree) => {
  ElMessageBox.confirm("您输入的数据将不会被保存，确定切换表单？", "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
    center: true
  })
    .then(() => {
      dialogCicategoryVisible.value = false;
      addRequestTemplateFormData.categoryNo = data.attr.cno;
      addRequestTemplateFormData.categoryName = data.attr.cname;
      findFormCustomByCiCategoryNo(data.attr.cno).then(res => {
        if (res != null) {
          showCustomerForm.value = true;
          //console.log("res")
          //console.log(atob(res.formCustomContents))
          //console.log(decode64(res.formCustomContents))
          let newParams = JSON.parse(JSON.stringify(res));
          let yyde = Base64.decode(newParams.formCustomContents); //解密
          console.log(yyde);
          let a = JSON.parse(yyde);
          let formCreateRulesArray: any[] = [];
          for (let i = 0; i < a.length; i++) {
            if (a[i].title == "所属客户") {
              a[i]["on"] = {
                focus(inject) {
                  dialogCiCompanyNoTableVisible.value = true;
                }
              };
            }
            // if(a[i].title=="请求分类"){
            // 	a[i]["on"]={
            // 			focus(inject){
            // 				dialogRequestCategoryTableVisible.value = true
            // 	}
            // 	}
            // }
            if (a[i].title == "请求用户") {
              a[i]["on"] = {
                focus(inject) {
                  dialogCreatedByTableVisible.value = true;
                }
              };
            }
            if (a[i].title == "负责人") {
              a[i]["on"] = {
                focus(inject) {
                  dialogOwnerVisible.value = true;
                }
              };
            }
            if (a[i].title == "使用人") {
              a[i]["on"] = {
                focus(inject) {
                  dialogUserNameVisible.value = true;
                }
              };
            }

            if (a[i].title == "位置") {
              a[i]["on"] = {
                focus(inject) {
                  dialogLocationTableVisible.value = true;
                }
              };
            }
            if (a[i].title == "部门") {
              a[i]["on"] = {
                focus(inject) {
                  dialogDepartmentVisible.value = true;
                }
              };
            }

            if (a[i].attrdataDictionary != null && a[i].attrdataDictionary != undefined) {
              let optionList = [];
              //优先级priority
              dataDictionaryItemsfindByCode(a[i].attrdataDictionary).then(res => {
                (res as any).forEach(function (element) {
                  // element["label"] = element["dname"];
                  // element["value"] = element["dname"];
                  //optionList.push({label:element["dname"],value:element["dcode"]})
                  a[i]["options"].push({ label: element["dname"], value: element["dcode"] });
                });
              });
            }
            formCreateRulesArray.push(a[i] as any);
          }
          formCreateRules.value = formCreateRulesArray;
        } else {
          showCustomerForm.value = false;
        }
      });
    })
    .catch(() => {
      ElMessage({
        type: "info",
        message: "取消操作"
      });
    });
};
const formData = ref({
  arrivalDate: "",
  assetsOriginalValue: "",
  buyDate: "",
  ciname: "",
  cino: "",
  companyName: "",
  companyNo: "",
  department: "",
  departmentName: "",
  depreciationIsZeroYears: "",
  lifeCycle: "",
  loc: "",
  locId: "",
  owner: "",
  ownerId: "",
  statusId: "",
  userName: "",
  userNameId: "",
  warningDate: "",
  warranty: ""
});

const templateNameBtn = async (formEl: FormInstance | undefined) => {
  if (addRequestTemplateFormData.templateName == "") {
    ElMessage({
      type: "error",
      message: "模板名称不能为空"
    });
    return;
  }
  onSubmitForm(formEl);
  templateNameDialogVisible.value = false;
};
const serviceDirectoryProTable = ref<ProTableInstance>();
const serviceDirectorySelectValue = ref();
const serviceDirectorySelectList = ref<any>([]);
const serviceDirectoryList = ref<any>([]);

const deleteserviceDirectory = async (index: any) => {
  serviceDirectoryList.value.splice(index, 1);
};
const serviceDirectoryColumns = reactive<ColumnProps<resCIList>[]>([
  { prop: "id", label: "ID", sortable: true },
  { prop: "cname", label: "服务名称", sortable: true, width: 260 },
  { prop: "operation", label: "操作项", fixed: "right", width: 200 }
]);
// 添加关联服务
const addServiceDir = () => {
  serviceDirectorySelectValue.value.forEach(function (element2) {
    traverseTree(serviceDirectorySelectList.value[0], node => {
      if (node.data == element2.toString()) {
        console.log("选中");
        console.log(node);
        let tmp = {
          id: node.attr.id,
          cname: node.attr.cname
        };
        //去重
        let addflag = true;
        serviceDirectoryList.value.forEach(val => {
          if (val.id == tmp.id) {
            addflag = false;
          }
        });
        if (addflag == true) {
          serviceDirectoryList.value.push(tmp);
        } else {
          ElMessage({
            type: "info",
            message: "存在相同数据 :   " + tmp["cname"] + "，  已自动过滤重复数据"
          });
        }
      }
    });
  });
};
//关联配置项开始
const ciProTable = ref<ProTableInstance>();
const selectCiDialogVisible = ref(false);
const ciColumns = reactive<ColumnProps<resCIList>[]>([
  { prop: "cino", label: "固定资产编号", sortable: true },
  { prop: "ciname", label: "名称", sortable: true, width: 260 },
  { prop: "categoryName", label: "分类", sortable: true, width: 260 },
  { prop: "status", label: "状态", sortable: true, width: 260 },
  { prop: "operation", label: "操作项", fixed: "right", width: 200 }
]);

export interface resCIList {
  ciname: string;
  cino: string;
  categoryName: string;
  categoryNo: string;
  status: string;
  ciId: number;
  attachmentStr: string;
  fileName: string;
  beginTime: string;
  companyName: string;
  companyNo: number;
  contractName: string;
  contractNo: number;
  dataFlag: number;
  description: string;
  dialect: string;
  endTime: string;
  finishTime: number;
  flagName: string;
  lastUpdater: string;
  packageName: string;
  respondTime: number;
  ruleName: string;
  ruleNo: number;
  rulePackageNo: number;
  salience: number;
  showFinishTime: string;
  showRespondTime: string;
  beforeOrAfter: boolean;
  beforeOrAfterStr: string;
  timeStr: string;
}
//关联配置项结束

//附件开始
const attachmentProTable = ref<ProTableInstance>();
const attachmentList = ref<any>([]);
const attachmentColumns = reactive<ColumnProps<resCIList>[]>([
  { prop: "fileName", label: "文件名称" },
  { prop: "operation", label: "操作项", fixed: "right", width: 200 }
]);
const uploadFileRes = async (param: any) => {
  let res = JSON.parse(JSON.stringify(param));
  let attachmentStr = res.fileName + "==" + res.msg + "==" + res.fileSize + "-s-";
  let attachment = {
    fileName: res.fileName,
    attachmentStr: attachmentStr
  };
  attachmentList.value.push(attachment);
};
// 添加附件
const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null);
const addAttachment = () => {
  const params = {
    title: "",
    tempApi: uploadFile,
    importApi: uploadFile,
    getTableList: ciProTable.value?.getTableList,
    addAttachmentMethod: uploadFileRes
  };
  dialogRef.value?.acceptParams(params);
};
// 删除附件
const deleteattachment = async (index: any) => {
  attachmentList.value.splice(index, 1);
};

//附件结束
const departmentCustomerSelectValue = ref();
const handleNodeClickDepartment = (data: any) => {
  console.log(data);
  departmentCustomerSelectValue.value = data;
};
const submitDepartment = () => {
  console.log("sdfaadfds");
  if (departmentCustomerSelectValue.value == null || departmentCustomerSelectValue.value == undefined) {
    ElMessage.info("请选择位置");
    return;
  }
  console.log("777777777");
  if ((departmentCustomerSelectValue.value.children as any).length > 0) {
    ElMessage.info("请选择叶子节点");
    return;
  }
  console.log("8888888888");
  console.log(departmentCustomerSelectValue.value);
  formData.value["department"] = departmentCustomerSelectValue.value.attr.orgName;
  formData.value["departmentName"] = departmentCustomerSelectValue.value.attr.orgName;
  //console.log(formData.value)
  //失去焦点避免重复打开 对话框
  let inputBox = document.getElementById("customerTypeNameInput") as HTMLInputElement; // 获取输入框元素
  inputBox.focus();
  // if(cwangEditor.value!=null){
  // 	(cwangEditor.value["editor"] as any).focus()
  // }
  dialogDepartmentVisible.value = false;
};
//开始
//请求客户
const dialogCompanyNoTableVisible = ref(false);
const dialogCreatedByTableVisible = ref(false); //创建人
const dialoguserNameTableVisible = ref(false); //创建人

const categorySelectValue = ref();
const categorySelectList = ref<any>([]);

//来源选择开始
const useStatusSelectValue = ref();
const useStatusSelectList = ref<any>([]);
const changeuseStatus = (val: any) => {
  useStatusSelectList.value.forEach(function (element) {
    let newElement = JSON.parse(JSON.stringify(element));
    if (newElement.value == val.toString()) {
      addRequestTemplateFormData.statusId = newElement.dcode;
    }
  });
};
//来源选择结束
const LocationSelectValue = ref();
const LocationSelectList = ref<any>([]);
const changeLocation = (val: any) => {
  if (val == "所在位置") {
    ElMessage.info("当前节点不可选");
    LocationSelectValue.value = addRequestTemplateFormData.loc;
    return;
  }
  traverseTree(LocationSelectList.value[0], node => {
    if (node.value == val.toString()) {
      addRequestTemplateFormData.locId = node.attr.id;
      addRequestTemplateFormData.loc = node.attr.cname;
    }
  });
};
// 父组件的值
const fatherValue = ref({ orgNo: 1 });

const addRequestTemplateFormData = reactive({
  isShowBorder: 0,
  isNewForm: true,
  creator: "",
  approvalNo: 0,
  reportId: 0,
  templateType: "configureItem",
  formId: 0,
  companyNo: 1,
  companyName: "",
  createdByName: "",
  createdByNo: "",

  categoryNo: "",
  categoryName: "",
  attachmentStr: "",
  templateName: "",
  templateId: "",
  statusId: "",
  locId: "",
  loc: "",
  buyDate: "",
  arrivalDate: "",
  warningDate: "",
  lifeCycle: 0,
  warranty: 0,
  assetsOriginalValue: 0,
  owner: "",
  ownerId: "",
  userName: "",
  userNameId: "",
  department: "",
  depreciationIsZeroYears: 0,
  cino: "",
  ciname: "",
  serviceDirIds: ""
});
const treeFilterData = ref<any>([]);
//客户选择子组件弹窗回调方法
const sendCompanyNoData = (data: any) => {
  dialogCompanyNoTableVisible.value = false;
  addRequestTemplateFormData.companyNo = data.orgNo;
  addRequestTemplateFormData.companyName = data.orgName;
  fatherValue.value.orgNo = data.orgNo;
};
//用户选择子组件弹窗回调方法
const sendOwnerData = (data: any) => {
  dialogCreatedByTableVisible.value = false;
  addRequestTemplateFormData.ownerId = data.userId;
  addRequestTemplateFormData.owner = data.fullName;
};
const senduserNameData = (data: any) => {
  dialoguserNameTableVisible.value = false;
  addRequestTemplateFormData.userNameId = data.userId;
  addRequestTemplateFormData.userName = data.fullName;
};

//分类选择
// const changeType = (val: any) => {
// 	ElMessageBox.confirm(
// 	    '您输入的数据将不会被保存，确定切换表单？',
// 	    '提示信息',
// 	    {
// 	      confirmButtonText: '确认',
// 	      cancelButtonText: '取消',
// 	      type: 'info',
// 	      center: true,
// 	    }
// 	  )
// 	    .then(() => {
// 	    traverseTree(categorySelectList.value[0], node => {
// 	      if (node.value == val.toString()) {
// 	        addRequestTemplateFormData.categoryNo = node.attr.cno;
// 	        addRequestTemplateFormData.categoryName = node.attr.cname;
// 	    	  findFormCustomByCiCategoryNo(node.attr.cno).then(res=>{
// 				  if(res!=null){
// 					  showCustomerForm.value=true
// 					  //console.log("res")
// 					   //console.log(atob(res.formCustomContents))
// 					  //console.log(decode64(res.formCustomContents))
// 					  let newParams = JSON.parse(JSON.stringify(res));
// 					  let yyde=Base64.decode(newParams.formCustomContents);//解密
// 					  console.log(yyde)
// 					  let a= JSON.parse(yyde)
// 					  let formCreateRulesArray :any[]=[]
// 					  for(let i=0;i<a.length;i++){

// 					  		if(a[i].title=="所属客户"){
// 					  			a[i]["on"]={
// 					  					focus(inject){
// 					  						dialogCiCompanyNoTableVisible.value = true
// 					  			}
// 					  			}
// 					  		}
// 					  		// if(a[i].title=="请求分类"){
// 					  		// 	a[i]["on"]={
// 					  		// 			focus(inject){
// 					  		// 				dialogRequestCategoryTableVisible.value = true
// 					  		// 	}
// 					  		// 	}
// 					  		// }
// 					  		if(a[i].title=="请求用户"){
// 					  			a[i]["on"]={
// 					  					focus(inject){
// 					  						dialogCreatedByTableVisible.value = true
// 					  			}
// 					  			}
// 					  		}
// 					  		if(a[i].title=="负责人"){
// 					  			a[i]["on"]={
// 					  					focus(inject){
// 					  						dialogOwnerVisible.value = true
// 					  			}
// 					  			}
// 					  		}
// 							if(a[i].title=="使用人"){
// 								a[i]["on"]={
// 										focus(inject){
// 											dialogUserNameVisible.value = true
// 								}
// 								}
// 							}
// 					  		if(a[i].title=="位置"){
// 					  			a[i]["on"]={
// 					  				focus(inject){
// 					  					dialogLocationTableVisible.value = true
// 					  			}
// 					  			}
// 					  		}
// 					  	if(a[i].attrdataDictionary!=null&&a[i].attrdataDictionary!=undefined){
// 					  		let optionList=[]
// 					  		//优先级priority
// 					  		dataDictionaryItemsfindByCode(a[i].attrdataDictionary).then(res => {
// 					  		  (res as any).forEach(function (element) {
// 					  		    // element["label"] = element["dname"];
// 					  		    // element["value"] = element["dname"];
// 					  			//optionList.push({label:element["dname"],value:element["dcode"]})
// 					  			a[i]["options"].push({label:element["dname"],value:element["dcode"]})
// 					  		  });
// 					  		});
// 					  	}
// 					  	formCreateRulesArray.push(a[i] as any)
// 					  }
// 					  formCreateRules.value=formCreateRulesArray

// 				  }else{
// 					  showCustomerForm.value=false
// 				  }

// 	    	  })
// 	      }
// 	    });
// 	    console.log(val);
// 	    })
// 	    .catch(() => {
// 	      // ElMessage({
// 	      //   type: 'info',
// 	      //   message: 'Delete canceled',
// 	      // })
// 	    })

// };

const onSubmitFormPre = async (formEl: FormInstance | undefined) => {
  templateNameDialogVisible.value = true;
};
const onSubmitForm = async (formEl: FormInstance | undefined) => {
  let serviceDirStr = "";
  for (let i = 0; i < serviceDirectoryList.value.length; i++) {
    if (serviceDirStr == "") {
      serviceDirStr = "?ciDto.serviceDirectoryNos=" + serviceDirectoryList.value[i].id;
    } else {
      serviceDirStr = serviceDirStr + "&ciDto.serviceDirectoryNos=" + serviceDirectoryList.value[i].id;
    }
  }
  let attachmentStr = "";
  for (let i = 0; i < attachmentList.value.length; i++) {
    if (attachmentStr == "") {
      attachmentStr = attachmentList.value[i].attachmentStr;
    } else {
      attachmentStr += attachmentList.value[i].attachmentStr;
    }
  }
  addRequestTemplateFormData.attachmentStr = attachmentStr;
  if (showCustomerForm.value == true) {
    console.log(formData.value);

    if (formData.value.companyNo == null || formData.value.companyNo == "") {
      ElMessage.error("请选择所属客户");
      return;
    }
    if (formData.value.ciname == null || formData.value.ciname == "") {
      ElMessage.error("请输入资产名称");
      return;
    }
    if (formData.value.cino == null || formData.value.cino == "") {
      ElMessage.error("请输入资产编号");
      return;
    }
    //数据拷贝
    Object.keys(formData.value).forEach(key => {
      addRequestTemplateFormData[`${key}`] = `${formData.value[key]}`;
    });
    saveConfigureItemTemplate(addRequestTemplateFormData, "ciDto", serviceDirStr).then(res => {
      console.log(res);
      ElMessage.success("新增成功");
      tabStore.removeTabs(route.fullPath);
      router.push(`/system/tools/contentTemplateManagement?pageNo=${Math.random().toFixed(3)}`);
    });
    console.log(formData.value);
  } else {
    if (!formEl) return;
    await formEl.validate((valid, fields) => {
      if (valid) {
        //校验成功
        saveConfigureItemTemplate(addRequestTemplateFormData, "ciDto", serviceDirStr).then(res => {
          console.log(res);
          ElMessage.success("新增成功");
          tabStore.removeTabs(route.fullPath);
          router.push(`/system/tools/contentTemplateManagement?pageNo=${Math.random().toFixed(3)}`);
        });
        ElMessage.success("保存成功");
      } else {
        ElMessage.error("请正确填写表单");
      }
    });
  }
};
// 返回列表
const backList = async () => {
  tabStore.removeTabs(route.fullPath);
  router.push(`/system/tools/contentTemplateManagement?pageNo=${Math.random().toFixed(3)}`);
};
const dialogServiceDirTableVisible = ref(false);
// 服务目录
const serviceDir = async () => {
  dialogServiceDirTableVisible.value = true;
  tabStore.removeTabs(route.fullPath);
  router.push(`/system/tools/regularTaskManagement?pageNo=${Math.random().toFixed(3)}`);
};

//结束

const ruleFormRef = ref<FormInstance>();
const activeName = ref("second");

const rules = reactive<FormRules>({
  companyName: [{ required: true, message: "请选择公司", trigger: "blur" }],
  createdByName: [{ required: true, message: "请选择请求用户", trigger: "blur" }],
  categoryName: [{ required: true, message: "请选择请求分类", trigger: "blur" }],

  cino: [{ required: true, message: "请输入资产编号", trigger: "blur" }],
  ciname: [{ required: true, message: "请输入资产名称", trigger: "blur" }]
});
onMounted(() => {
  //加载公司信息
  getjgglmessage().then(res => {
    let newParams = JSON.parse(JSON.stringify(res));
    addRequestTemplateFormData.companyName = newParams.companyName;
    addRequestTemplateFormData.companyNo = newParams.companyNo == 0 ? 1 : newParams.companyNo;
  });
  //加载用户数据
  getCurrentLoginUser().then(res => {
    let newRes = JSON.parse(JSON.stringify(res));
    addRequestTemplateFormData.createdByNo = newRes.userId;
    addRequestTemplateFormData.createdByName = newRes.fullName;
    // addRequestTemplateFormData.technicianName=newRes.loginName;
    addRequestTemplateFormData.creator = newRes.loginName;
  });
  getUserDepartment().then(res => {
    let newres = JSON.parse(JSON.stringify(res));
    traverseTree(newres[0], node => {
      node.lable = node.attr.orgNo;
      node.value = node.attr.orgName;
    });
    departmentSelectList.value = newres;
  });
  //请求分类选择树
  getCimClass().then(res => {
    // 使用traverseTree遍历树
    traverseTree(res as any, node => {
      if (node.attr.cname == "配置项分类") {
        node["disabled"] = true;
      }
      node["lable"] = node.attr.cname;
      node["value"] = node.attr.cname;
    });
    let k: any[] = [];
    k.push(res);
    categorySelectList.value = k;
  });

  //状态
  dataDictionaryItemsfindByCode("useStatus").then(res => {
    (res as any).forEach(function (element) {
      element["lable"] = element["dname"];
      element["value"] = element["dname"];
    });
    useStatusSelectList.value = res as any;
  });
  //服务目录
  getCategoryTreeAllData("Service").then(res => {
    // 使用traverseTree遍历树
    traverseTree(res as any, node => {
      node["lable"] = node.attr.cname;
      node["value"] = node.attr.cname;
    });
    serviceDirectorySelectList.value = [res as any];
  });
  //位置
  getCategoryTreeAllData("Location").then(res => {
    // 使用traverseTree遍历树
    traverseTree(res as any, node => {
      node["lable"] = node.attr.cname;
      node["value"] = node.attr.cname;
    });
    LocationSelectList.value = [res as any];
  });
  getUserDepartment().then(res => {
    let newres = JSON.parse(JSON.stringify(res));
    traverseTree(newres[0], node => {
      if (node.attr.orgName == "服务机构") {
        node["disabled"] = true;
      }
      if (node.attr.orgName == "被服务机构") {
        node["disabled"] = true;
      }
      node.lable = node.attr.orgNo;
      node.value = node.attr.orgName;
    });
    treeFilterData.value = newres;
  });
  //编辑时加载数据
  let query = JSON.parse(JSON.stringify(route.query));
  // findByTemplateId findCiByIds
  if (query.id != undefined) {
    findByTemplateId({ templateId: query.id }, "templateDTO", []).then(res => {
      let newParams = JSON.parse(JSON.stringify(res));

      console.log(newParams);
      let valArr = newParams.dto.attachmentStr.split("-s-");
      for (let i = 0; i < valArr.length; i++) {
        if (valArr[i] == "") {
          continue;
        }
        let attObj = valArr[i].split("==");
        let attachment = {
          fileName: attObj[0],
          attachmentStr: valArr[i] + "-s-"
        };
        attachmentList.value.push(attachment);
      }
      let serviceNos = newParams.dto.serviceNos == undefined ? {} : newParams.dto.serviceNos;
      Object.keys(serviceNos).forEach(key => {
        let tmpservice = {
          id: `${key}`,
          cname: `${serviceNos[key]}`
        };
        serviceDirectoryList.value.push(tmpservice);
      });

      addRequestTemplateFormData.creator = newParams.dto.creator == undefined ? "" : newParams.dto.creator;
      addRequestTemplateFormData.serviceDirIds = newParams.serviceDirIds == undefined ? "" : newParams.serviceDirIds;
      addRequestTemplateFormData.reportId = newParams.dto.reportId == undefined ? "" : newParams.dto.reportId;
      addRequestTemplateFormData.templateType = newParams.templateType == undefined ? "" : newParams.templateType;
      addRequestTemplateFormData.formId = newParams.formId == undefined ? "" : newParams.formId;
      addRequestTemplateFormData.companyName = newParams.dto.companyName == undefined ? "" : newParams.dto.companyName;
      addRequestTemplateFormData.companyNo = newParams.dto.companyNo == undefined ? 1 : newParams.dto.companyNo;
      addRequestTemplateFormData.createdByName = newParams.dto.createdByName == undefined ? "" : newParams.dto.createdByName;
      addRequestTemplateFormData.createdByNo = newParams.dto.createdByNo == undefined ? "" : newParams.dto.createdByNo;
      addRequestTemplateFormData.categoryName = newParams.dto.categoryName == undefined ? "" : newParams.dto.categoryName;
      addRequestTemplateFormData.categoryNo = newParams.dto.categoryNo == undefined ? "" : newParams.dto.categoryNo;
      categorySelectValue.value = newParams.dto.categoryName == undefined ? "" : newParams.dto.categoryName;
      addRequestTemplateFormData.loc = newParams.dto.locationName == undefined ? "" : newParams.dto.locationName;
      addRequestTemplateFormData.locId = newParams.dto.locId == undefined ? "" : newParams.dto.locId;
      LocationSelectValue.value = newParams.dto.locationName == undefined ? "" : newParams.dto.locationName;
      addRequestTemplateFormData.attachmentStr = newParams.dto.attachmentStr == undefined ? "" : newParams.dto.attachmentStr;
      addRequestTemplateFormData.templateName = newParams.templateName == undefined ? "" : newParams.templateName;
      addRequestTemplateFormData.templateId = newParams.templateId == undefined ? "" : newParams.templateId;

      addRequestTemplateFormData.statusId = newParams.dto.statusId == undefined ? "" : newParams.dto.statusId;
      useStatusSelectList.value.forEach(function (element) {
        let newElement = JSON.parse(JSON.stringify(element));
        if (newElement.dcode == newParams.dto.statusId) {
          useStatusSelectValue.value = newElement.dname;
        }
      });

      addRequestTemplateFormData.buyDate = newParams.dto.buyDate == undefined ? "" : newParams.dto.buyDate;
      addRequestTemplateFormData.arrivalDate = newParams.dto.arrivalDate == undefined ? "" : newParams.dto.arrivalDate;
      addRequestTemplateFormData.warningDate = newParams.dto.warningDate == undefined ? "" : newParams.dto.warningDate;
      addRequestTemplateFormData.lifeCycle = newParams.dto.lifeCycle == undefined ? "" : newParams.dto.lifeCycle;
      addRequestTemplateFormData.warranty = newParams.dto.warranty == undefined ? "" : newParams.dto.warranty;
      addRequestTemplateFormData.assetsOriginalValue =
        newParams.dto.assetsOriginalValue == undefined ? "" : newParams.dto.assetsOriginalValue;
      addRequestTemplateFormData.owner = newParams.dto.owner == undefined ? "" : newParams.dto.owner;
      addRequestTemplateFormData.ownerId = newParams.dto.ownerId == undefined ? "" : newParams.dto.ownerId;
      addRequestTemplateFormData.userName = newParams.dto.userName == undefined ? "" : newParams.dto.userName;
      addRequestTemplateFormData.userNameId = newParams.dto.userNameId == undefined ? "" : newParams.dto.userNameId;
      addRequestTemplateFormData.department = newParams.dto.department == undefined ? "" : newParams.dto.department;
      addRequestTemplateFormData.depreciationIsZeroYears =
        newParams.dto.depreciationIsZeroYears == undefined ? "" : newParams.dto.depreciationIsZeroYears;
      addRequestTemplateFormData.ciname = newParams.dto.ciname == undefined ? "" : newParams.dto.ciname;
      addRequestTemplateFormData.cino = newParams.dto.cino == undefined ? "" : newParams.dto.cino;

      findFormCustomByCiCategoryNo(addRequestTemplateFormData.categoryNo).then(res => {
        if (res != null) {
          showCustomerForm.value = true;
          //console.log("res")
          //console.log(atob(res.formCustomContents))
          //console.log(decode64(res.formCustomContents))
          let formCustomRes = JSON.parse(JSON.stringify(res));
          let yyde = Base64.decode(formCustomRes.formCustomContents); //解密
          console.log(yyde);
          let a = JSON.parse(yyde);
          let formCreateRulesArray: any[] = [];
          for (let i = 0; i < a.length; i++) {
            if (a[i].title == "所属客户") {
              a[i]["on"] = {
                focus(inject) {
                  dialogCiCompanyNoTableVisible.value = true;
                }
              };
            }
            // if(a[i].title=="请求分类"){
            // 	a[i]["on"]={
            // 			focus(inject){
            // 				dialogRequestCategoryTableVisible.value = true
            // 	}
            // 	}
            // }
            if (a[i].title == "请求用户") {
              a[i]["on"] = {
                focus(inject) {
                  dialogCreatedByTableVisible.value = true;
                }
              };
            }
            if (a[i].title == "负责人") {
              a[i]["on"] = {
                focus(inject) {
                  dialogOwnerVisible.value = true;
                }
              };
            }
            if (a[i].title == "使用人") {
              a[i]["on"] = {
                focus(inject) {
                  dialogUserNameVisible.value = true;
                }
              };
            }

            if (a[i].title == "位置") {
              a[i]["on"] = {
                focus(inject) {
                  dialogLocationTableVisible.value = true;
                }
              };
            }
            if (a[i].title == "部门") {
              a[i]["on"] = {
                focus(inject) {
                  dialogDepartmentVisible.value = true;
                }
              };
            }

            if (a[i].attrdataDictionary != null && a[i].attrdataDictionary != undefined) {
              let optionList = [];
              //优先级priority
              dataDictionaryItemsfindByCode(a[i].attrdataDictionary).then(res => {
                (res as any).forEach(function (element) {
                  // element["label"] = element["dname"];
                  // element["value"] = element["dname"];
                  //optionList.push({label:element["dname"],value:element["dcode"]})
                  a[i]["options"].push({ label: element["dname"], value: element["dcode"] });
                });
              });
            }
            formCreateRulesArray.push(a[i] as any);
          }
          formCreateRules.value = formCreateRulesArray;

          let attrVals = newParams.dto.attrVals == undefined ? {} : newParams.dto.attrVals;
          setTimeout(() => {
            formData.value.arrivalDate = newParams.dto.arrivalDate == undefined ? "" : newParams.dto.arrivalDate;
            formData.value.assetsOriginalValue =
              newParams.dto.assetsOriginalValue == undefined ? "" : newParams.dto.assetsOriginalValue;
            formData.value.buyDate = newParams.dto.buyDate == undefined ? "" : newParams.dto.buyDate;
            formData.value.companyName = newParams.dto.companyName == undefined ? "" : newParams.dto.companyName;
            formData.value.companyNo = newParams.dto.companyNo == undefined ? 1 : newParams.dto.companyNo;
            formData.value.ciname = newParams.dto.ciname == undefined ? "" : newParams.dto.ciname;
            formData.value.cino = newParams.dto.cino == undefined ? "" : newParams.dto.cino;
            formData.value.department = newParams.dto.department == undefined ? "" : newParams.dto.department;
            formData.value.departmentName = newParams.dto.department == undefined ? "" : newParams.dto.department;
            formData.value.depreciationIsZeroYears =
              newParams.dto.depreciationIsZeroYears == undefined ? "" : newParams.dto.depreciationIsZeroYears;
            formData.value.lifeCycle = newParams.dto.lifeCycle == undefined ? "" : newParams.dto.lifeCycle;
            formData.value.loc = newParams.dto.locationName == undefined ? "" : newParams.dto.locationName;
            formData.value.locId = newParams.dto.locId == undefined ? "" : newParams.dto.locId;
            formData.value.owner = newParams.dto.owner == undefined ? "" : newParams.dto.owner;
            formData.value.ownerId = newParams.dto.ownerId == undefined ? "" : newParams.dto.ownerId;
            formData.value.statusId = newParams.dto.statusId == undefined ? "" : newParams.dto.statusId;
            formData.value.userName = newParams.dto.userName == undefined ? "" : newParams.dto.userName;
            formData.value.userNameId = newParams.dto.userNameId == undefined ? "" : newParams.dto.userNameId;
            formData.value.warningDate = newParams.dto.warningDate == undefined ? "" : newParams.dto.warningDate;
            formData.value.warranty = newParams.dto.warranty == undefined ? "" : newParams.dto.warranty;

            Object.keys(attrVals).forEach(key => {
              Object.keys(formData.value).forEach(key2 => {
                if (`${key}` == `${key2}`) {
                  if (`${attrVals[key]}` == "true") {
                    formData.value[`${key2}`] = true;
                  } else {
                    formData.value[`${key2}`] = `${attrVals[key]}`;
                  }
                }
              });
            });
          }, 1500);
        } else {
          showCustomerForm.value = false;
        }
      });
    });
  }
});

interface TreeNode {
  value: any;
  lable: any;
  children?: TreeNode[];
  id: string;
  name: string;
  attr: any;
  data: any;
}

function traverseTree(node: TreeNode, callback: (node: TreeNode) => void) {
  callback(node);
  if (node.children) {
    node.children.forEach(child => traverseTree(child, callback));
  }
}
</script>

<style scoped lang="scss">
@import "./index.scss";
.item {
  width: 500px;
}
.custom-tree {
  height: 450px; /* 你想要的高度 */
  overflow-y: auto; /* 添加垂直滚动条 */
}
</style>
